|
||
Post
Effects/ Post shading
|
||
Post ShadingTutorial level: Advanced Example project: 'samples/v5samples/post shading studio'. In this tutorial we will examine how to collect channel information from the ray tracer in order to evaluate the basic illumination model in the post processing phase. Post processed surface shading has some advantages:
The illumination model of Realsoft 3D - and the rendering pipeline in general - is open and customizable. This means that the parameters of a post shading system are not fixed. The user can any time code a new VSL material, which changes surface illumination in a totally new way. It's impossible to reproduce the functionality of the new shader accurately in a post shading system, which assumes other kind of shading behavior. A simple post shading system renders very quickly and allows interactive adjusting of parameters. A complex post shading solution which controls the result image in a detailed manner - providing even object or light source specific parameters - is slower to use, but naturally provides much more possibilities to adjust the image. The optimal choice between speed and flexibility depends on each scene. The standard setup of Realsoft 3D includes a set of example components for post shading. These components allow quite a detailed control over post shading. The components are built using the standard VSL objects and post effects, and therefore they can be modified and tailored to suit all kind of projects. For example, unused elements can be deleted to speed up rendering.
Post Shading ExampleLet's experiment how to use the post shading system, which is included in the program setup.1. Model first a test scene: a semi-reflective floor surface, a glass object over the floor, a mirror object, etc. Feel free to use your imagination. Add a couple of point lights or spotlights to the scene. In the property window, set the Quality slider of the light sources to the value 1. This is the minimal value, which turns light sampling over a spherical light source volume on. If you test render an image, shadows will show clearly visible sampling noise. Turn also view's flashlight off, because the post shading system includes its own independent flashlight.
2. Go to the material tab of the select window. Choose New/From Template from the popup menu of the select window. Use the opened file browser to find and load in the material 'realsoft3d/materials/illumination/capture channels'. Deselect all geometry objects (for example: activate the view and hit Ctrl+t). Then drag and drop the loaded material 'capture_channels' to the view window. This maps the shader to the root level of the scene. Shading information of all objects will be collected.
3. Switch to the render settings tab of the select window. Using the property window, set the antialiasing level of the render settings object, which you plan to use (for example reasonable quality), to zero. The post shading system cannot afterwards separate illumination components from antialiased pixels, and therefore ray tracer antialiasing would cause shading errors. Antialiasing must be done after the post processing by down scaling the image resolution. 4. Go to the post image effects tab of the select window. Open the popup menu and choose Paste from a File. Load in the file 'realsoft3d/posteffects/post_shading'. Drag and drop either post_shading or post_shading_draft from the select window into the view window. The draft version does not use supersampled resolution to antialiase and is therefore 4 times faster. 5. Open the popup menu of the view window and select Ray Trace+Backup.
Fist the ray traced image appears, then, after a while, a post-shaded version. The post shaded version looks quite similar to the original image, except that the dithered shadows are now smooth.
The next step is to experiment with the post shading parameters. Switch to the post image effects tab of the select window, and open the property window. 6. To make reflections sharper, select the blur_reflection effect and decrease the Blur Level value using the property window. Then select Render/Post Process from the view popup menu. A new image appears much quicker, because ray tracing was not computed. 7. To make shadows even smoother, select the blur_shadows effect. Increase either the Blur Level value or the Iterations value. Then apply Render/Post Process. 8. To remove all reflections from surfaces, select the evaluate_shading effect and set Reflection Weight to black (0,0,0). Then apply Render/Post Process. 9. Change the Flashlight value of the evaluate_shading effect to pale yellow (0.8, 0.8, 0.6). Post process again. The image gets a warm fill light effect 10. Set Specularity Weight to (1.6 1.1 1.1), then Post Process. Specular highlights become brighter and get a red tone around the white brightness maximum.
As the experiments above show, the most important component of the system is the evaluate_shading effect. It is a VSL effect, which weights the stored channels and then recombines them to a new image. The VSL structure of the effect is quite straightforward and easy to customize. By default, all weights are set to the level (1,1,1), which reproduces the original ray traced illumination. Note, that although the weights are presented as RGB colors, their range is not limited to 0..1 interval. The full list of shading parameters is explained below.
It should be noted that these parameters control only the first step of the recursive ray tracing. For the sake of speed and memory consumption, the system stores the channel values only from the first step of the ray trace recursion. For example, a self-illuminated surface which is seen in a mirror reflection does not become darker when you decrease the ambient weight. Instead, the reflection weight controls its appearance. The fog blurring effect, which is part of the post shading system, needs some special attention. With it, you can reduce the sampling noise of volume sampled fog shaders. Applying a pixel accurate fog shader to blurred shading components sometimes creates clearly visible errors. You can compensate this by making fog blurring as large as the maximum of the other blur components, such as the shadow blur effect.
Let's take a closer look at the channel capture material. Go to the material tab of the select window, make sure that the material capture_channels is selected and open the property window. The material interface displays a large number of switches 'XXX Capture Off'. With these switches, you can turn off collection of unused data and consequently speed up rendering. By default, all channels used by the post effect shading are enabled.
This material can be used in collecting information for all kinds of post processing purposes. The switches and their relation to underlying channels are:
Some important notes:
The idea behind the capture_channels material is that in includes all surface related shaders. In each shader, the material examines how the total illumination and other relevant channels change and stores the observed changes to a set of additional channels bt_diffuse, bt_ambient, etc. As explained earlier in this tutorial, only the first step of ray trace recursion is stored. |
||
|
||
![]() |
![]() |
|
|